package com.yangcsoft.modules.deptmanage.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yangcsoft.common.utils.PageUtils;
import com.yangcsoft.common.utils.Query;

import com.yangcsoft.modules.deptmanage.dao.ProjectInfoDao;
import com.yangcsoft.modules.deptmanage.entity.ProjectInfoEntity;
import com.yangcsoft.modules.deptmanage.service.ProjectInfoService;


@Service("projectInfoService")
public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoDao, ProjectInfoEntity> implements ProjectInfoService {
    @Autowired
    private ProjectInfoDao dao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = params.get("key").toString();
        Page<ProjectInfoEntity> page = this.selectPage(
                new Query<ProjectInfoEntity>(params).getPage(),
                new EntityWrapper<ProjectInfoEntity>()
                                             .like("project_no",key)
                 .or()
                                                             .like("project_name",key)
                 .or()
                                                             .like("final_customer",key)
                 .or()
                                                             .like("contract_type",key)
                 .or()
                                                             .like("project_director",key)
                 .or()
                                                             .like("project_manage",key)
                 .or()
                                                             .like("project_status",key)
                 .or()
                                                             .like("start_date",key)
                 .or()
                                                             .like("end_date",key)
                 .or()
                                                             .like("create_date",key)
                 .or()
                                                             .like("create_user",key)
                 .or()
                                                             .like("update_date",key)
                 .or()
                                                            .like("update_user",key)
                                    );

        return new PageUtils(page);
    }

    @Override
    public void save(ProjectInfoEntity entity) {
        dao.save(entity);
    }


}
